package org.example;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Paths;

/**
 * @author liyishan
 * @date 2024/7/17 17:37
 * @apiNote
 */

public class CodeGenerator {

    public static void main(String[] args) {
        String url= "jdbc:mysql://localhost:3306/lysh?serverTimezone=UTC";
        String username = "root";
        String password = "81568156";

        FastAutoGenerator.create(url, username, password)
                .globalConfig(builder -> builder
                        .author("Baomidou")
                        .outputDir(Paths.get(System.getProperty("user.dir")+"/mybatis-baomidou") + "/src/main/java")
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("org.example")
                        .entity("entity")
                        .mapper("mapper")
                        .service("service")
                        .serviceImpl("service.impl")
                        .xml("mapper.xml")
                )
                .strategyConfig(builder -> builder
                        .addInclude("employees")
                        .entityBuilder()
                        .enableLombok()

                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }

}
